package composite;

import org.apache.tools.ant.taskdefs.condition.Or;

import java.util.ArrayList;
import java.util.List;

/**
 * 节点：大学
 */
public class University extends OrganizationComponent{

    List<OrganizationComponent> organizationComponentList = new ArrayList<>();

    public University(String orgName) {
        super(orgName);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponentList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponentList.remove(organizationComponent);
    }

    @Override
    protected void print() {
        System.out.println("大学 =>" + getOrgName());
        for (OrganizationComponent organizationComponent : organizationComponentList) {
            organizationComponent.print();
        }
    }
}
